home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / toolbook / import / import.tbk (.txt) < prev   
Asymetrix ToolBook File  |  1991-02-01  |  24KB  |  405 lines

  1. Import into current background
  2. System
  3. Tms Rmn
  4. `D|D|
  5. Tms Rmn
  6. `D|D|
  7. Tms Rmn
  8. `D|D|
  9. Tms Rmn
  10. `D|D|
  11. System
  12. Tms Rmn
  13. `D|D|
  14. Courier
  15. `D|D|
  16. enterbook
  17. sizetopage
  18. Tms Rmn
  19. `D|D|
  20. Tms Rmn
  21. `D|D|
  22. `D|D|
  23. enterbook
  24. enterbook
  25. sizetopage
  26. ;Ishowhotwords
  27. @lengthlist
  28. filename
  29. import
  30. --Joseph Brick.
  31. November 90.
  32. -- Put 
  33. your 
  34. -- When 
  35. prompts 
  36. a list 
  37. p, type the names
  38. recordfields on 
  39. current 
  40. /separated 
  41. Hcommas.
  42. -- Be sure 
  43. Zthem 
  44. Rorder that they appear 
  45. mfile.
  46. asks 
  47. pgive 
  48. ASCII 
  49. xa toolbook 
  50. -- The 
  51.  delimeter can be either a 
  52. 4reclist,filename,successcount,linecount,recordcount,stripquotes,\
  53. filetype,lengthlist,linetot
  54. -- Get 
  55. existence
  56. ("Enter 
  57. "(Must be a 
  58. = "no such 
  59.  exists."
  60. X"tbkfile.dll"
  61. \getfilesize(
  62. listed should correspond 
  63. fthose 
  64. data 
  65.  (Example: company,city,state):"\
  66. = "Cancel"
  67. user accepted 
  68. defaults
  69. usingdefaults 
  70. -- test 
  71. recordFields specified are on 
  72. evaltest 
  73. "There 
  74. && "named" && 
  75.  & "." 
  76. -- store 
  77. "Choose 
  78. f"Delimited" 
  79. "Fixed" 
  80. -- don't 
  81. lengths
  82. umber 
  83. each 
  84. ("RecordField "& 
  85.  & "."& 
  86. occupies on 
  87. & "," 
  88. -- Give 
  89. choice 
  90. "Remove quotation marks 
  91. values?" 
  92. f"Yes" 
  93. = "No"
  94. -- Initialize 
  95.  counts 
  96. lines 
  97. aren't blank;
  98. actually imported;
  99. -- charsRead 
  100. Vthus far read 
  101. -- temp 
  102. holds 
  103. -- maxbuffer 
  104. maximum 
  105. will 
  106. )once.
  107. %low 
  108. %high 
  109. %memory 
  110. 1allow.
  111. following loop executes 
  112. Thave been 
  113. dealt 
  114. amount remaining 
  115. -- track 
  116. charsToRead 
  117. anything 
  118. leftover 
  119. -- (i.e., 
  120. split up a 
  121. -- This 
  122. parses individual 
  123. &    empty 
  124. does 
  125. xcontain a full 
  126. ) > 0
  127. -- find 
  128. carriage 
  129. point 
  130. fline, 
  131. crLoc 
  132. parseline 
  133.  = charsread
  134. happens 
  135. -- Send 
  136. be parsed.
  137. Since 
  138. becomes 
  139. equal 
  140. -- loops terminate.
  141. Stripchars removes 
  142. -- marker, 
  143. stripchars(
  144. (26),
  145. -- a single 
  146. inner 
  147. broken
  148. -- so 
  149. outer 
  150. fileRead some more.
  151. importSummary
  152. handler takes one 
  153. fills 
  154. T's, 
  155.  matches the
  156. x, inform 
  157. ) <> 
  158. U" && 
  159.  && "
  160. " && 
  161. given." \
  162. f"Continue" 
  163. importsummary
  164. holder
  165. chose 
  166. (34),
  167.  jives 
  168. flenghts 
  169. ) < (
  170. U" && 
  171.  && "
  172. " &&\
  173.  total"\
  174. Tindicated." 
  175. fine; 
  176. charstart 
  177. stripspaces(
  178. gives a status report 
  179. "Imported" && 
  180.  && "
  181. " && 
  182. " && 
  183.  & "."
  184. every instance 
  185. source
  186. leading 
  187. trailing 
  188.  <> " "
  189. tonup
  190. parseline
  191. buttonup
  192. importSummary
  193. stripchars
  194. stripspaces
  195. buttonup
  196. Enter ASCII filename.
  197. (Must be a comma-delimited or fixed-field file):
  198. cancel
  199. no such file
  200. No such file exists.
  201. tbkfile.dll
  202. getfilesize
  203. getfilesize
  204. tbkfile.dll
  205. Enter list of recordfield names separated by commas
  206. in order of the data in the file (Example: company,city,state):
  207. reclist
  208. Cancel
  209. reclist
  210. evaltest
  211. There is no recordfield on the current background
  212. named
  213. Cancel
  214. reclist
  215. Choose the ASCII file type:
  216. Delimited
  217. Fixed
  218. Cancel
  219. Cancel
  220. fixed
  221. lengthlist
  222. RecordField 
  223. Enter the number of characters it occupies on each line 
  224. of the file.
  225. lengthlist
  226. Cancel
  227. lengthlist
  228. Remove quotation marks from field values?
  229. parseline
  230. charsread
  231. stripchars
  232. parseline
  233. ximportSummary
  234. fline
  235. crLoc
  236. charsToRead
  237. maxbuffer
  238. charsRead
  239. usingdefaults
  240. filesize
  241. reclist
  242. filename
  243. successcount
  244. linecount
  245. recordcount
  246. stripquotes
  247. filetype
  248. lengthlist
  249. linetot
  250. parseline
  251. stripchars
  252. stripchars
  253. delimited
  254. Field count of line
  255. does not match recordfield list given.
  256. Continue
  257. Cancel
  258. Cancel
  259. ximportsummary
  260. y5newpage
  261. stripchars
  262. The length of line
  263. of file
  264. does not match total
  265. characters indicated.
  266. Continue
  267. Cancel
  268. Cancel
  269. !import
  270. y5newpage
  271. stripspaces
  272. charstart
  273. summary
  274. holder
  275. reclist
  276. linecount
  277. recordcount
  278. filename
  279. successcount
  280. stripquotes
  281. filetype
  282. lengthlist
  283. linetot
  284. fline
  285. importSummary
  286. Imported
  287. out of
  288. records from
  289. linecount
  290. filename
  291. successcount
  292. recordcount
  293. stripchars
  294. source
  295. stripspaces
  296. source
  297. Begin import
  298. 4origcolor
  299. "sign" 
  300. info 
  301. buttondown
  302. buttonup
  303. buttondown
  304. 60,50,100
  305. origcolor
  306. buttonup
  307. origcolor
  308. AAAA:
  309. ToolBook always creates a brand new background when you use its native Import command. The scripts in the button on this background allow you to import values into any number of recordFields on the current background from ASCII delimited or fixed-field files. 
  310. When you click the button labeled "Begin Import," you will be prompted for an ASCII delimited or ASCII fixed-field file name.  After entering the filename, you will be prompted for a list of recordField names.  Try it out in this book by listing the recordFields "A" through "C." The files packaged with this book, ASCII.DEL and ASCII.FIX, are examples of the delimited and fixed-field file types.  They each contain data for three fields. 
  311. To import ASCII delimited or fixed-field files into the background of your choice, simply copy the button labeled "Begin Import" to your background. nd.  
  312. asciihelp 
  313. buttonup
  314. buttonup
  315. asciihelp
  316. fixedhelp 
  317. buttonup
  318. buttonup
  319. fixedhelp
  320. delfile 
  321. buttonup
  322. buttonup
  323. delfile
  324. fixedfile 
  325. buttonup
  326. buttonup
  327. fixedfile
  328. asciihelp 
  329. fixedhelp 
  330. delfile 
  331. fixedfile 
  332. info 
  333. buttonup
  334. buttonup
  335. fixedfile
  336. delfile
  337. fixedhelp
  338. asciihelp
  339. Importing ASCII delimited or fixed-field data into the current background.ckground.
  340. fixedhelp
  341. In ASCII fixed-field files, the number of characters in each data field determines where one data field ends and another begins.  This number is constant for each data field for each line of the file.  Below is a sample from a fixed-field file.  Notice that the data field "name" always occupies the first 20 characters of each line, followed by "date" which occupies characters 21 to 28 of each line, and so on.  
  342. Tom Jones          10/10/45Accounting
  343. Ed Poe             03/23/54M.I.S.
  344. The file called ASCII.FIX that comes with this book contains three data fields:  the first occupies the first 20 characters of each line, the second takes up the next 8, and the third occupies the remaining 24 characters.24 characters. characters.
  345. buttonup
  346. buttonup
  347. asciihelp
  348. ASCII delimited refers to a standard file format in which the   recordFields for each ToolBook page (or fields for each database record) occupy a single line in the file.  The values on each line are separated by commas and are sometimes surrounded by quotation marks.  Such files are created by ToolBook's Export command when "delimited" is specified.  Below is a sample of an ASCII delimited file representing  the data fields "name," "birthdate", and "department." 
  349. "Tom Jones","10/10/45","Accounting"
  350. "Ed Poe","03/23/54","M.I.S."
  351. The file ASCII.DEL that comes with this package contains three comma-delimited data fields.
  352. buttonup
  353. buttonup
  354. delfile
  355. "Ann Tyler",06/23/39,"Shipping" 
  356. "Barbara Bush",04/04/23,"Operations" 
  357. "Ginger Grant",03/05/45,"Sales" 
  358. "Jerry Mathers",04/02/90,"Telesales" 
  359. "Joe Petroni",12/04/38,"Aviation Mechanics" 
  360. "John Lydon",03/06/61,"Technical Support" 
  361. "Keith Partridge",08/04/53,"Technical Support" 
  362. "Marsha Brady",07/07/64,"Development" 
  363. "Martha Ray",09/30/31,"Operations" 
  364. "Nina Hagen",03/04/56,"Marketing" 
  365. "Sean Cassidy",08/03/45,"Sales" 
  366. "Shaft",01/31/71,"Security" 
  367. "Thurston Howell, III",09/23/45,"Finance" 
  368. "Tony Dow",05/06/40,"Shipping"   
  369. buttonup
  370. buttonup
  371. fixedfile
  372. Ann Tyler           06/23/39Shipping                
  373. Barbara Bush        04/04/23Operations              
  374. Ginger Grant        03/05/45Sales                   
  375. Jerry Mathers       04/02/90Telesales               
  376. Joe Petroni         12/04/38Aviation Mechanics      
  377. John Lydon          03/06/61Technical Support       
  378. Keith Partridge     08/04/53Technical Support       
  379. Marsha Brady        07/07/64Development             
  380. Martha Ray          09/30/31Operations              
  381. Nina Hagen          03/04/56Marketing               
  382. Sean Cassidy        08/03/45Sales                   
  383. Shaft               01/31/71Security                
  384. Thurston Howell, III09/23/45Finance                 
  385. Tony Dow            05/06/40Shipping                
  386. buttonup
  387. buttonup
  388. buttonup
  389. buttonup
  390. import
  391. View script
  392. RBreclist
  393. 20,8,24,
  394. 20,8,24,
  395. "Do you want 
  396. delete 
  397. "Yes" 
  398. buttonup
  399. buttonup
  400. Do you want to delete all pages from the background?
  401. clear
  402. Delete pages
  403. a,b,c
  404. B    h@@
  405.